package com.skyworth.userapi.client.fallback;

import com.skyworth.common.feign.AbstractFeignFallback;
import com.skyworth.core.exception.FeignException;
import com.skyworth.core.pojo.dto.PageResDTO;
import com.skyworth.core.pojo.dto.ResDTO;
import com.skyworth.userapi.client.AccountInfoClient;
import com.skyworth.userapi.pojo.dto.accountinfo.req.*;
import com.skyworth.userapi.pojo.dto.accountinfo.res.*;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <p>
 * 代理商员工表 模块FALLBACK
 * </p>
 *
 * @author wuxj
 * @since 2020-04-23
 */
@Slf4j
@Component
public class AccountInfoFallback extends AbstractFeignFallback implements FallbackFactory<AccountInfoClient>  {

    @Override
    public AccountInfoClient create(Throwable throwable) {
        return new AccountInfoClient() {

            @Override
            public ResDTO<PageResDTO<AccountInfoListResDTO>> list(AccountInfoListReqDTO accountInfoListReqDTO) {
                return handleException(throwable);
            }

            @Override
            public ResDTO<AccountInfoGetResDTO> get(Long id) {
                return handleException(throwable);
            }

            @Override
            public ResDTO<Void> add(AccountInfoAddReqDTO accountInfoAddReqDTO) {
                return handleException(throwable);
            }

            @Override
            public ResDTO<Void> delete(List<Long> ids) {
                return handleException(throwable);
            }

            @Override
            public ResDTO<Void> update(AccountInfoUpdateReqDTO accountInfoUpdateReqDTO) {
                return handleException(throwable);
            }
        };
    }
}